<?php
/**
 * PHP Class
 *
 * LICENSE
 *
 * Processing: Config Reader
 *
 * @category   	Gnn Cms
 * @package    	Gnn Config
 * @copyright  	Copyright vinanewstar.vn@gmail.com
 * @author		GiangNam (vinanewstar.vn@gmail.com)
 * @license    	GNU General Public License Version 2 or later (the "GPL")
 * @version     v1.0 Jul 2, 2013 || 10:24:02 AM
 */
class Zendvn_Config{

	protected $_config;

	public function __construct($fileConfigs,$section = 'default',$adapter = "ini",$options =null){
		switch ($adapter){
			case "ini": $config = new Zend_Config_Ini($fileConfigs,$section,$options);
						break;
			case "xml": $config = new Zend_Config_Xml($fileConfigs,$section,$options);
						break;
				
		}
		$this->_config = $config;
	}

	public function getConfig($path = null){
		$value = $this->_config->toArray();
		if($path != null){
			$subPath = explode('.', $path);
			foreach ($subPath as $val){
				$value = $value[$val];
			}
		}
		return $value;
	}
}